package org.dinner.order.dao.impl;

import java.util.List;

import org.dinner.order.dao.OrderItemDAO;
import org.dinner.order.model.OrderItem;
import org.springframework.stereotype.Repository;

@Repository
public class OrderItemDAOImpl extends BaseDAOImpl<OrderItem> implements OrderItemDAO {
	private static final String ENTITY_NAME = "OrderItem";
	
	public List<OrderItem> listByUserId(int userId) {
		List list = sessionFactory.getCurrentSession().getNamedQuery(ENTITY_NAME + ".listByUserId")
				.setInteger("userId", userId).list();
		return list;
	}

	@Override
	protected String getQueryPrefix() {
		return ENTITY_NAME;
	}

}
